package cc11001100.snakeyaml;

import cc11001100.snakeyaml.domain.Foo;
import org.yaml.snakeyaml.Yaml;

import java.io.IOException;

/**
 * 实例化任意类
 *
 * @author CC11001100
 */
public class PocNewAnyClassMain {

    public static void main(String[] args) throws IOException {

        Yaml yaml = new Yaml();
        // 实例化类，类上的恶意代码会被执行
        Foo foo = yaml.loadAs("!!cc11001100.snakeyaml.domain.Foo {}", Foo.class);
        System.out.println(foo);
        System.out.println(yaml.dump(foo));

    }

}
